<?php

    echo CHtml::openTag('div');

    echo CHtml::activeFileField($this->model,$this->attribute,$this->htmlOptions);


    echo CHtml::openTag('div', array('id'=>'fupload-image'));
    echo CHtml::closeTag('div', array());
    if($this->model->{$this->attribute}!='')
    {   

    ?>       
    <div id="img">
    <?php
        echo CHtml::ajaxLink(
        'Delete Image',          // the link body (it will NOT be HTML-encoded.)
        array('post/DeleteImageOfPost'), // the URL for the AJAX request. If empty, it is assumed to be the current URL.
        array(
        'update'=>'#img',
        'data' => array( 'id' => $this->model->id),        
        ),
        array('name'=>'testLink', 'confirm' => 'Do you want delete this image?')
        );

        

      ?>
    <br/>  
    <img width="200px" src="http://localhost/blog/images/<?php echo $this->model->{$this->attribute}  ?>" />
    
    </div>
    <?php
    } 
    echo CHtml::closeTag('div');
?>